local sk__qingcheng = fk.CreateSkill {

  name = "sk__qingcheng",

  tags = {},

}



sk__qingcheng:addEffect("viewas", {
  name = "sk__qingcheng",
  pattern = "slash,jink",
  anim_type = "defensive",
  prompt = function(self, player, selected_cards, selected)
    if player.chained then
      return "#sk__qingcheng-jink"
    else
      return "#sk__qingcheng-slash"
    end
  end,
  card_filter = Util.FalseFunc,
  view_as = function(self, player, cards)
    local card
    if player:hasSkill(sk__qingcheng.name) then
      if player.chained then
        card = Fk:cloneCard("jink")
      else
        card = Fk:cloneCard("slash")
      end
    end
    card.skillName = sk__qingcheng.name
    return card
  end,
  before_use = function(self, player, use)
    if player.chained then
      player:setChainState(false)
    else
      player:setChainState(true)
    end
  end,
  enabled_at_play = function(self, player)
    return not player.chained
  end,
  enabled_at_response = function(self, player, response)
    if player.chained then
      return Fk.currentResponsePattern and Exppattern:Parse(Fk.currentResponsePattern):match(Fk:cloneCard("jink"))
    else
      return Fk.currentResponsePattern and Exppattern:Parse(Fk.currentResponsePattern):match(Fk:cloneCard("slash"))
    end
  end,
})

return sk__qingcheng
